import request from '@/axios';
import {baseUrl} from '@/config/env';

export const loginByUsername = (username, password, code, uuid) => request({
    url: baseUrl + '/login',
    method: 'post',
    meta: {
        isToken: false
    },
    headers: {
        Authorization: 'Basic d2ViOndlYg=='
    },
    params: {
        username,
        password,
        code,
        uuid
    }
})

export const getUserInfo = () => request({
    url: baseUrl + '/system/sysUser/getUserInfo',
    method: 'get'
});

export const refreshToken = () => request({
    url: baseUrl + '/user/refresh',
    method: 'post'
})

export const getMenu = (type = 0) => request({
    url: baseUrl + '/system/sysMenu/getMenu',
    method: 'get',
    params: {
        type
    }
});

export const getTopMenu = () => request({
    url: baseUrl + '/system/sysMenu/getTopMenu',
    method: 'get'
});

export const sendLogs = (list) => request({
    url: baseUrl + '/user/logout',
    method: 'post',
    data: list
})

export const logout = () => request({
    url: baseUrl + '/logout',
    meta: {
        isToken: false
    },
    method: 'get'
})
